{% extends 'encyclopedia/base.html' %}

{% block title %}相机分类 - 相机百科{% endblock %}

{% block content %}
    <h1>相机分类</h1>
    <p class="lead mb-4">按类型浏览相机信息</p>
    
    <div class="row">
        {% for category in categories %}
            <div class="col-md-6 col-lg-4">
                <div class="card">
                    <div class="card-body">
                        <h5 class="card-title">
                            <a href="{% url 'encyclopedia:category_detail' category.id %}">{{ category.name }}</a>
                        </h5>
                        <p class="card-text">包含 {{ category.cameras.count }} 个相机词条</p>
                        {% if category.description %}
                            <p class="card-text text-muted">{{ category.description|truncatechars:100 }}</p>
                        {% endif %}
                        <a href="{% url 'encyclopedia:category_detail' category.id %}" class="btn btn-primary">查看相机列表</a>
                    </div>
                    <div class="card-footer text-muted">
                        创建于：{{ category.created_at|date:"Y-m-d" }}
                    </div>
                </div>
            </div>
        {% empty %}
            <div class="col-12">
                <div class="alert alert-warning" role="alert">
                    暂无相机分类。
                </div>
            </div>
        {% endfor %}
    </div>
{% endblock %}